import pygetwindow

wins = pygetwindow.getAllWindows()
for win in wins:
    title = win.title
    title = title.strip()
    if title == '':
        continue
    else:
        print(win.title)

input('按任意键结束')
